/*
csyingwu
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace Kaidou.Model
{

	/// <summary>
	/// ITrnJuchuUketuke interface for NHibernate mapped table 'trn_juchu_uketuke'.
	/// </summary>
	public interface ITrnJuchuUketuke
	{
		#region Public Properties
		
		TrnJuchuUketukeId Id
		{
			get ;
			set ;
		}
		
		string UketukeSt
		{
			get ;
			set ;
		}
		
		DateTime RegDate
		{
			get ;
			set ;
		}
		
		DateTime StartDate
		{
			get ;
			set ;
		}
		
		DateTime EndDate
		{
			get ;
			set ;
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
		#region Serialize
		/// <summary>
		/// Method for entity class serialization to XML file
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to write to. Will be overwritten if already exists.</param>
		void SerializeToFile( string pXMLFilePath );
		
		/// <summary>
		/// Method for entity class deserialization from XML file. Does not change this object content but returns another deserialized object instance
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to read from.</param>
		/// <returns>TrnJuchuUketuke object restored from XML file</returns>
		TrnJuchuUketuke DeserializeFromFile( string pXMLFilePath );
		
		#endregion
		
		
	}

	/// <summary>
	/// TrnJuchuUketuke object for NHibernate mapped table 'trn_juchu_uketuke'.
	/// </summary>
	[Serializable]
	public class TrnJuchuUketuke : ITrnJuchuUketuke
	{
		#region Member Variables

		protected TrnJuchuUketukeId _id;
		protected string _uketukeSt;
		protected DateTime _regDate;
		protected DateTime _startDate;
		protected DateTime _endDate;
		protected bool _isDeleted;
		protected bool _isChanged;
		#endregion
		
		#region Constructors
		public TrnJuchuUketuke() {}
		
		public TrnJuchuUketuke(TrnJuchuUketukeId id, string uketukeSt, DateTime regDate, DateTime startDate, DateTime endDate)
		{
			this._id = id; /*id*/ 
			this._uketukeSt = uketukeSt; /*c*/ 
			this._regDate = regDate; /*c*/ 
			this._startDate = startDate; /*c*/ 
			this._endDate = endDate; /*c*/ 
		}
		
		#endregion
		
		
		
		#region Public Properties
		
		public TrnJuchuUketukeId Id
		{
			get { return _id; }
			set { _isChanged |= (_id != value); _id = value; }
		}
		
		public string UketukeSt
		{
			get { return _uketukeSt; }
			set { _isChanged |= (_uketukeSt != value); _uketukeSt = value; }
		}
		
		public DateTime RegDate
		{
			get { return _regDate; }
			set { _isChanged |= (_regDate != value); _regDate = value; }
		}
		
		public DateTime StartDate
		{
			get { return _startDate; }
			set { _isChanged |= (_startDate != value); _startDate = value; }
		}
		
		public DateTime EndDate
		{
			get { return _endDate; }
			set { _isChanged |= (_endDate != value); _endDate = value; }
		}
		

		public bool IsDeleted
		{
			get { return _isDeleted; }
			set { _isDeleted = value; }
		}
		
		public bool IsChanged
		{
			get { return _isChanged; }
			set { _isChanged = value; }

		}
		
		#endregion 
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			TrnJuchuUketuke castObj = null;
			try
			{
				castObj = (TrnJuchuUketuke)obj;
			} catch(Exception) { return false; } 
			return (castObj != null) && 
				this._id.Equals( castObj.Id );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _id.GetHashCode();/*id*/
			return hash; 
		}
		#endregion
		
		#region Serialize
		/// <summary>
		/// Method for entity class serialization to XML file
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to write to. Will be overwritten if already exists.</param>
		public virtual void SerializeToFile( string pXMLFilePath )
		{
			System.Xml.Serialization.XmlSerializer seriliaser = new System.Xml.Serialization.XmlSerializer( this.GetType() );
			using(System.IO.TextWriter txtWriter = new System.IO.StreamWriter( pXMLFilePath ))
			{
				seriliaser.Serialize(txtWriter, this);
				txtWriter.Close();
			}
		}
		/// <summary>
		/// Method for entity class deserialization from XML file. Does not change this object content but returns another deserialized object instance
		/// </summary>
		/// <param name="pXMLFilePath">Path of the XML file to read from.</param>
		/// <returns>TrnJuchuUketuke object restored from XML file</returns>
		public virtual TrnJuchuUketuke DeserializeFromFile( string pXMLFilePath )
		{
			TrnJuchuUketuke _result = null;
			
			System.Xml.Serialization.XmlSerializer seriliaser = new System.Xml.Serialization.XmlSerializer( this.GetType() );
			using(System.IO.TextReader txtReader = new System.IO.StreamReader( pXMLFilePath ))
			{
				_result = (TrnJuchuUketuke)seriliaser.Deserialize( txtReader );
				txtReader.Close();
			}
			return _result;
		}
		#endregion
		
		
	}
	
	#region Custom ICollection interface for TrnJuchuUketuke 

	
	public interface ITrnJuchuUketukeCollection : ICollection
	{
		TrnJuchuUketuke this[int index]{	get; set; }
		void Add(TrnJuchuUketuke pTrnJuchuUketuke);
		void Clear();
	}
	
	[Serializable]
	public class TrnJuchuUketukeCollection : ITrnJuchuUketukeCollection
	{
		private IList<TrnJuchuUketuke> _arrayInternal;

		public TrnJuchuUketukeCollection()
		{
			_arrayInternal = new List<TrnJuchuUketuke>();
		}
		
		public TrnJuchuUketukeCollection( IList<TrnJuchuUketuke> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<TrnJuchuUketuke>();
			}
		}

		public TrnJuchuUketuke this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((TrnJuchuUketuke[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(TrnJuchuUketuke pTrnJuchuUketuke) { _arrayInternal.Add(pTrnJuchuUketuke); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<TrnJuchuUketuke> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
